#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import List, NoReturn
from loguru import logger

from sqlalchemy import column, func, select, update,insert ,delete,Result
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload, noload
from sqlalchemy.sql import Select

from app.models.Task import Task



# from schema.obstacle import CreateObstacle,UpdateObstacle
# from schema.task import CreateTask,UpdateTask
# ============================================================================================================================================================================================



# async def create_task(self, db: AsyncSession, obj_in: CreateTask) -> NoReturn:
#     db_obj = self.model(**obj_in.dict())
#     db.add(db_obj)
#     await db.commit()

# async def update_task(self, db: AsyncSession, obj_in: UpdateTask) -> NoReturn:
#     await db.execute(update(self.model).where(self.model.task_name == obj_in.task_name)).values(task_list=obj_in.task_list)
#     await db.commit()

#     res2 = await db.execute(select(self.model).where(self.model.task_name == obj_in.task_name))
#     print(res2.scalar())


    

# async def get_task_by_name(self,db:AsyncSession,name:str) -> Result:
#     res = await db.execute(select(self.model).where(self.model.name == name))
#     return res 

# async def delete_task(self, db: AsyncSession, task_name: str) -> NoReturn:
#     await db.execute(delete(self.model).where(self.model.task_name == task_name ))
#     await db.commit()


# async def get_all_tasks(self,db:AsyncSession) -> Result:
#     res = await db.execute(select(self.model))
#     return res 






